interface Car {
    String driver();
}

interface BenzCar extends Car {
}

interface AudiCar extends Car {
}

interface BmwCar extends Car {
}

class BenzSUV implements BenzCar {
    @Override
    public String driver() {
        return "开奔驰SUV";
    }
}

class BenzMPV implements BenzCar {
    @Override
    public String driver() {
        return "开奔驰MPV";
    }
}

class BenzSmall implements BenzCar {
    @Override
    public String driver() {
        return "开奔驰小轿车";
    }
}

class AudiSUV implements AudiCar {
    @Override
    public String driver() {
        return "开奥迪SUV";
    }
}

class AudiMPV implements AudiCar {
    @Override
    public String driver() {
        return "开奥迪MPV";
    }
}

class BmwMPV implements BmwCar {
    @Override
    public String driver() {
        return "开宝马MPV";
    }
}

interface DriverMPV {
    Car getMPV();
}

interface DriverSUV {
    Car getSUV();
}

interface DriverSmall {
    Car getSmall();
}

class BenzDriver implements DriverMPV, DriverSUV, DriverSmall {
    @Override
    public Car getMPV() {
        return new BenzMPV();
    }

    @Override
    public Car getSUV() {
        return new BenzSUV();
    }

    @Override
    public Car getSmall() {
        return new BenzSmall();
    }
}

class AudiDriver implements DriverMPV, DriverSUV {
    @Override
    public Car getMPV() {
        return new AudiMPV();
    }

    @Override
    public Car getSUV() {
        return new AudiSUV();
    }
}

class BmwDriver implements DriverMPV {
    @Override
    public Car getMPV() {
        return new BmwMPV();
    }
}

interface Driver {
    Car getBenz();
    Car getAudi();
    Car getBmw();
}

class MPVDriver implements Driver {
    @Override
    public Car getBenz() {
        return new BenzMPV();
    }
    @Override
    public Car getAudi() {
        return new AudiMPV();
    }
    @Override
    public Car getBmw() {
        return new BmwMPV();
    }
}

// 老板聘用多个司机来开不同名牌(奔驰/奥迪)的不同车型
public class AbstractFactoryTest {

    static public void test(Car car) {
        System.out.printf("老板叫司机%s去见客户!\n", car.driver());
    }

    static public void main(String [] args) {
        test(new BenzDriver().getMPV());
        test(new BenzDriver().getSUV());
        test(new AudiDriver().getMPV());
        test(new AudiDriver().getSUV());
        test(new BmwDriver().getMPV());
        test(new BenzDriver().getSmall());
        System.out.println("====================");
        test(new MPVDriver().getBenz());
        test(new MPVDriver().getAudi());
        test(new MPVDriver().getBmw());
    }
}
